package com.example.springmapstructsample;

import com.example.springmapstructsample.bean.*;
import com.example.springmapstructsample.dto.*;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface BeanToDtoConverter {

    BeanToDtoConverter INSTANCE = Mappers.getMapper(BeanToDtoConverter.class);

//    @Mapping(target = "lang", source = "proLang")
    UserDto userToUserDto(User programer);

    @Mapping(target = "name",defaultValue = "suv")
    CarDto carToCarDto(Car car);

    @Mapping(source = "name",target = "name1")
    UserDto1 user1ToUserDto1(User1 user1);

    @Mapping(target = "name",ignore = true)
    CarDto1 car1ToCarDto1(Car1 car1);

    UserDto2 user2ToUserDto2(User2 user2);

    List<UserDto2> user2ListToUserDto2List(List<User2> user2);
}
